-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #23223: Add handling for classes deriving from Capability during Setup #23248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #23223: Add handling for classes deriving from Capability during Setup #23248
Conversation
…ogic
Error: import language.experimental.captureChecking
class Cap extends caps.Capability:
def use[T](body: Cap ?=> T) = body(using this) -- [E007] Type Mismatch Error: tests/pos-custom-args/captures/i20237.scala:4:43
4 | def use[T](body: Cap ?=> T) = body(using this)
| ^^^^
|Found: (Cap.this : Cap^{cap.rd})
|Required: Cap^{cap².rd}
|
|where: cap is the universal root capability
| cap² is a fresh root capability created in method use when checking argument to parameter x$0 of method apply |
cc @Linyxus |
Fix typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tweaked the previous scheme so that we only add one capture set variable to a self type. Doing a ++ is correct, but creates two variables, one for the original set and one for the result of the ++.
Oh, I didn't realize there is another variable |
Fix #23223
Updated the Setup logic to handle classes deriving from Capability by adding a fresh capability.